#ifndef QTEMPLATETREEWIDGET_H
#define QTEMPLATETREEWIDGET_H

#include <QTreeWidget>
#include <QMap>

class QFormWidget;

struct tagTemplateInfo
{
    QString     m_file_name;
    QString     m_name;
};

class QTemplateTreeWidget : public QTreeWidget
{
    Q_OBJECT
public:
    explicit QTemplateTreeWidget(QWidget *parent = 0);
    
    void    add_default_item(const QString &file_name,const QString& name);

    void    add_more_item(const QString &file_name,const QString& name);

    void    remove(QTreeWidgetItem *item);
    void    movetotemp(QTreeWidgetItem* item);

    void    set_base_path(const QString &base_path);
protected:
    void drawRow(QPainter *painter, const QStyleOptionViewItem &options, const QModelIndex &index) const;
signals:
    void select(tagTemplateInfo* info);
    void remove_signal(const QString &path);
    void changed(const QString &old,const QString &now);
public slots:
protected slots:
    void current_Item(QTreeWidgetItem*,QTreeWidgetItem*);
protected:
    friend class QTemplateDeletgate;
protected:
    QMap<QTreeWidgetItem*,tagTemplateInfo*>    m_default_items;
    QMap<QTreeWidgetItem*,tagTemplateInfo*>    m_more_items;
    QMap<QString,QTreeWidgetItem*>                  m_nameToItem;
    QTreeWidgetItem*                                m_default;
    QTreeWidgetItem*                                m_more;
    QString                                         m_base_file_path;
};

#endif // QTEMPLATETREEWIDGET_H
